/*
 * Alloy Analyzer
 * Copyright (c) 2002 Massachusetts Institute of Technology
 *
 * The Alloy Analyzer is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * The Alloy Analyzer is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with the Alloy Analyzer; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

package alloy.ast;
import alloy.parse.AlloyPrepass;

public class Specification extends TreeNode {

    /**
     * index of open {@link Modules} in child list
     */
    private static final int MODULES_INDEX = 0;

    /** module in focus */
    private Module _focus;

    /** the alloy/lang modules imported by this spec **/
    private Modules _lang;

    /** parser used to obtain this Specification **/
    private AlloyPrepass.ParserNames _parserNames;

    public Specification(Location location_, Module focus_, Modules lang_, Modules modules_, AlloyPrepass.ParserNames names_) {
        super(location_, modules_);
        _focus = focus_;
	_lang = lang_;
	_parserNames = names_;
    }


// DEAD
//    public Specification(Module focus_, Modules lang_, Modules modules_, AlloyParser parser_) {
//        super(Location.UNKNOWN, modules_);
//        _focus = focus_;
//	_lang = lang_;
//        _parser = parser_;
//    }



    //GET AND SET METHODS

    /**
     * @return the parser used to parse this
     **/
    public AlloyPrepass.ParserNames getParserNames() {
	return _parserNames;
    }

    /**
     * Sets the parser of this
     * @param parser_ new parser object
     **/
    // DEAD
//    public void setParser(AlloyParser parser_) {
//	_parser = parser_;
//    }

    /**
     * gets the alloy/lang of this
     * @return the {@link Modules}
     */
    public Modules getLang() {
        return _lang;
    }

    /**
     * sets the alloy/lang of this
     * @param lang_ the new {@link Modules} for this
     */
    public void setLang(Modules lang_) {
        _lang = lang_;
    }

    /**
     * gets the focus of this
     * @return the {@link Module}
     */
    public Module getFocus() {
        return _focus;
    }

    /**
     * sets the focus of this
     * @param focus_ the new {@link Module} for this
     */
    public void setFocus(Module focus_) {
        _focus = focus_;
    }

    /**
     * gets the modules of this
     * @return the {@link Modules}
     */
    public Modules getModules() {
        return (Modules)childAt(MODULES_INDEX);
    }

    /** set the Modules of this */
    public void setModules(Modules newChild_) {
        setChild(MODULES_INDEX, newChild_);
    }

    /**
     * accept an AST visitor
     * @param visitor_ the visitor
     */
    protected void acceptVisitor(ASTVisitor visitor_) {
        visitor_.visit(this);
    }

    /**
     * accept a returning AST visitor
     * @param visitor_ the visitor
     * @return the Object returned by the visitor
     */
    protected Object acceptReturnVisitor(ASTReturnVisitor visitor_) {
        return visitor_.visit(this);
    }

    public String toString()
    {
        return "Specification";
    }

}
